package tech.aistar.mapper;

import org.apache.ibatis.annotations.Select;
import tech.aistar.pojo.User;
import tech.aistar.pojo.UserVo;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select * from user")
    List<User> findAll();

    @Select("select  * from user where id=#{id}")
    User getById(Integer id);

    @Select("select * from user where username like concat('%',#{username},'%') and status=#{status}")
    List<User> findByUsernameAndStatus(String username,Integer status);

    @Select("select * from user where username like concat('%',#{username},'%') and status=#{status}")
    List<User> getByUsernameAndStatus(User user);

    @Select("select * from user where username like concat('%',#{uname},'%') and status=#{stats}")
    List<User> listByUsernameAndStatus(UserVo userVo);

    @Select("select * from user where email=#{value}")
    User getByEmail(String email);

    int delById(Integer id);
}